home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / CD32 / CD32-Tools / simcd32-401 / SimCD32 / SimCD32.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1993-12-22  |  3.0 KB  |  83 lines

  1. /* SimCD32.rexx 931214 */
  2.  
  3. /* This is an interactive program for experimenting with ARexx and      */
  4. /* SimCD32's ARexx commands.  At the SIM> prompt, you can enter        */
  5. /* any valid ARexx clause.  This script will immediately execute        */
  6. /* those statements and display any results.  To terminate, type        */
  7. /* EXIT at the SIM> prompt.                                             */
  8.  
  9. /* The SimCD32 ARexx port supports the following commands:              */
  10.  
  11. /* Quit       -- Cause SimCD32 to exit.                                 */
  12. /* GetISOName -- Returns the file name of the current ISO image.        */
  13. /* SetISOName -- Set the ISO image to the given file (must provide the  */
  14. /*               complete path name). This can be used to change the    */
  15. /*               image that is mounted, (say from work:isoimage to      */
  16. /*               work:isoimage2 or whatever).                           */
  17. /*               Example:                                               */
  18. /*                       "SetISOName work:isoimage2"                    */
  19. /*               Note that the quotes are required                      */
  20.  
  21. /* These constants let us control of the console's text colors. */
  22. csi = "9b"x                              /* Command Sequence Introducer */
  23. normal  = csi || "31;40m"
  24. reverse = csi || "33;41m"
  25. hilite  = csi || "32;40m"
  26.  
  27. say ""
  28. say ""
  29. say reverse "SIM: Interactive SimCD32/ARexx Console" normal
  30. say " The SimCD32 ARexx port supports the following commands:" hilite
  31.  
  32. say " Quit       -- Cause SimCD32 to exit."
  33. say " GetISOName -- Returns the file name of the current ISO image."
  34. say " SetISOName -- Set the ISO image to the given file (must provide the"
  35. say "               complete path name and whole command must be in quotes)."
  36. say "               This can be used to change the image that is mounted,"
  37. say "               (say from work:isoimage to work:isoimage2 or whatever)."
  38. say "               Example:"
  39. say '                       "SetISOName work:isoimage2"'
  40. say "               Note that the quotes are required" normal
  41. say ""
  42. say "  (Type EXIT to terminate)"
  43. say ""
  44.  
  45.  
  46. address SimCD32                /* Send commands to the SimCD32 ARexx port. */
  47. options prompt hilite || "SIM>" || normal || " "     /* A nice prompt. */
  48. options results              /* We want results back. */
  49. signal on syntax             /* Handle errors using our own ARexx error handler. */
  50.  
  51.  
  52. do forever
  53.  
  54.     parse pull command       /* get a command from the user */
  55.  
  56.     drop rc                  /* clear out previous return code */
  57.  
  58.     drop result              /* clear out previous result */
  59.  
  60.     interpret command        /* execute the command */
  61.  
  62.  
  63.     /* Variable 'result' contains the result of our command. */
  64.     /* We'll only print 'result' if we actually got something. */
  65.  
  66.     if ( symbol('result') == 'VAR' ) then
  67.         say "The result is:" result
  68.  
  69.     say ""
  70. end
  71.  
  72.  
  73. /* Our own ARexx handler for fatal errors */
  74.  
  75. syntax:
  76.  
  77. if ( rc = 13 ) then
  78.     say "*** SimCD32 port SimCD32 not found ***"
  79. else
  80.     say "*** Error" rc "at line" sigl "of SimCD32.rexx ***"
  81.  
  82. exit
  83.